package com.itheima.mall.controller;

import com.itheima.mall.service.SmsCouponHistoryService;
import com.itheima.mall.vo.PageResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Slf4j
@RequestMapping("/couponHistory")
public class SmsCouponHistoryController {

    @Autowired
    private SmsCouponHistoryService smsCouponHistoryService;

    /**
     * 根据优惠券id，使用状态，订单编号分页获取领取记录
     */
    @GetMapping("/list")
    public ResponseEntity<PageResult> list(Integer couponId,String orderSn,Integer pageNum,
                                           Integer pageSize,Integer useStatus){
        PageResult pageResult = smsCouponHistoryService.list(couponId,orderSn,pageNum,pageSize,useStatus);
        return ResponseEntity.ok(pageResult);
    }

}
